package com.stadium.web.repository;

import com.stadium.web.domain.Venue;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
/**
 * 场馆Repository接口
 * 
 * @author ruoyi
 * @date 2020-03-15
 */
public interface VenueRepository extends JpaRepository<Venue, Long>
{

    /**
     * 查询场馆
     *
     * @param id 场馆ID
     * @return 场馆
     */
//    public Venue findByIdAndStatus(Long id, Byte status);


    @Modifying
    @Transactional
    @Query("update #{#entityName} set status = ?1  where id in ?2")
    Integer updateStatusByIdIn(Byte code, List<Long> ids);

    List<Venue> findByUserId(Long id);

    Venue findByUserIdAndId(Long userId, Long venueId);

    List<Venue> findByRegionId(Long regionId);
}
